package models;

import javax.cache.Cache;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;

import entities.BlockCustomer;

import helpers.GeneralHelper;


public class BlockCustomerModel  {
	private Objectify ofy;
	
	private Cache cache = null;
	
	private String cachePrefix = "block_customer_";
	
	private static BlockCustomerModel instance = null;
	
	public static BlockCustomerModel getInstance() {
		if (instance == null) {
			instance = new BlockCustomerModel();
		}
		
		return instance;
	}
	
	private BlockCustomerModel() {
		try {
			ObjectifyService.register(BlockCustomer.class);
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		cache = GeneralHelper.getCache();
		ofy = GeneralHelper.getObjectify();
	}
	
	public BlockCustomer get(String customer) {
		BlockCustomer blockCustomer = null;
		
		try {
			blockCustomer = ofy.get(BlockCustomer.class, customer);
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		return blockCustomer;
	}
	
	public void insert(BlockCustomer blockCustomer) {
		ofy.put(blockCustomer);
	}
	
	public void delete(BlockCustomer blockCustomer) {
		ofy.delete(blockCustomer);
	}
}
